import { createStore, applyMiddleware } from "redux";
import thunk from "redux-thunk";
import { composeWithDevTools } from "redux-devtools-extension";
import rootReducer from "./reducers";
import { getToken } from "@/utils/token";
// 第一个参数：reducer
// 第二个参数：初始状态
// 第三个参数：增强器，比如，中间件
// createStore(reducer, [preloadedState], [enhancer]);
const initialState = {
    login: getToken(),
};
const middlewares = composeWithDevTools(applyMiddleware(thunk));
const store = createStore(rootReducer, initialState, middlewares);

export default store;
